package com.stars.empoly.vmodel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.stars.empoly.model.MemberListTo
import com.stars.empoly.utils.net.NetEngine
import com.trailer.base.base.BRRepository
import com.trailer.base.base.BRViewModel
import com.trailer.base.net.IResp
import kotlinx.coroutines.launch

/**
 *
 *on 2020/9/25
 */
class BillVModel(application: Application) : BRViewModel<BRRepository>(application) {


    var timeType:String?="0"
    var time:String?=""
    var type:String?="0"

    var bean= MutableLiveData<MemberListTo>()


    fun setTips(money:String?,type:String?):String{
        if(type.equals("2")||type.equals("3")){
            return "-$money"
        }
        return "+$money"
    }


    fun getCount(){

        viewModelScope.launch {
            var it=NetEngine.service.memberAccountTo(timeType,type,time,10, repository().page)
            if(it.ok()){
                bean.value=it.data
            }
        }
    }


    override fun apiFunc(): suspend () -> IResp<*> {
        return { NetEngine.service.memberAccount("1",timeType,type,time,10, repository().page) }
    }




}
